import com.sun.org.apache.bcel.internal.generic.IF_ACMPEQ;

import java.util.Arrays;
import java.util.LinkedList;
import java.util.Queue;



public class Test {

    public int lengthOfLongestSubstring2(String s) {
        if (s.length() == 0) {
            return 0;
        }
        char[] chart = s.toCharArray();
        int max = Integer.MIN_VALUE;
        int left = 0;
        for(int right = 0; right < s.length(); right++){
            for(int i = left; i < right; i ++ ){
                if (chart[right] == chart[i]) {
                    left = i + 1;
                }
            }
            max = Math.max(max, right - left + 1);
        }
        return max;
    }

    public static void main(String[] args) {
        LinkedList<Integer> queue = new LinkedList<>();
        queue.offer(12);
        queue.offer(23);
        queue.offer(34);
        queue.offer(45);
        Integer val = queue.poll();
        System.out.println(val);
        System.out.println(queue.peek());
        val = queue.poll();
        System.out.println(val);
        System.out.println(queue.poll());
        System.out.println(queue.peekFirst());
    }


    public static void main1(String[] args) {

        Queue<Integer> queue = new LinkedList<>();
        queue.offer(12);
        queue.offer(23);
        queue.offer(34);
        queue.offer(45);
        Integer val = queue.poll();//12
        System.out.println(val);
        System.out.println(queue.peek());
        val = queue.poll();
        System.out.println(val);
    }
}
